package com.caojing.mvvmlibrarydemo

import android.os.Bundle
import android.view.LayoutInflater
import com.akn.mvvmlibrary.activity.BaseActivity
import com.akn.mvvmlibrary.network.StringDialogCallback
import com.blankj.utilcode.util.LogUtils
import com.caojing.mvvmlibrarydemo.databinding.ActivityMainBinding
import com.lzy.okgo.OkGo

class MainActivity : BaseActivity<ActivityMainBinding,MainViewModel>() {

    override fun getLayoutId(): Int {
        return R.layout.activity_main
    }

    override fun initView() {
        binding.tvName.text="android"
        viewModel.requestFun()
        var layoutInflater=LayoutInflater.from(this).inflate(R.layout.layout_button,binding.constraintLayout)
    }

    override fun variableId(): Int {
      return BR.mainViewModel
    }

    override fun createViewModel(): MainViewModel {
        return MainViewModel()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        LogUtils.d("生命周期-onCreate")
    }

    override fun onStart() {
        super.onStart()
        LogUtils.d("生命周期-onStart")
    }

    override fun onResume() {
        super.onResume()
        LogUtils.d("生命周期-onResume")
    }

    override fun onPause() {
        super.onPause()
        LogUtils.d("生命周期-onPause")
    }

    override fun onStop() {
        super.onStop()
        LogUtils.d("生命周期-onStop")
    }

    override fun onDestroy() {
        super.onDestroy()
        LogUtils.d("生命周期-onDestroy")
    }

}